//
//  main.swift
//  MonsterTown
//
//  Created by liuzhu on 2018/9/26.
//  Copyright © 2018 liuzhu. All rights reserved.
//

//Foundation框架，包含了一组主要用来和OC交互的类。
//import Foundation

print("Hello, World!")

var myTown = Town()
//print("Population:\(myTown.population),number of stoplights:\(myTown.numberOfStopLights)")
myTown.printDescription()

myTown.changePopulation(by: 500)
myTown.printDescription()


//let genericMonster  = Monster()
//genericMonster.town = myTown
//genericMonster.terrorizeTown()

let fredTheZombie = Zombie()
fredTheZombie.town = myTown
fredTheZombie.terrorizeTown()
fredTheZombie.town?.printDescription()


let myTownSize = myTown.townSize
print(myTownSize)

var myTownSize1 = myTown.townSize1
print(myTownSize1)
myTown.changePopulation(by: 100001)
myTownSize1 = myTown.townSize1
print(myTownSize1)


//属性观察者
myTown.changePopulation(by: 100002)
